package com.zfzs.post.modules.transaction.service;

import com.zfzs.post.modules.transaction.domain.BenefitDay;
import com.zfzs.post.modules.transaction.service.dto.BenefitDay4MineDTO;
import com.zfzs.post.modules.transaction.service.dto.BenefitDayQueryCriteria;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;
import java.util.List;


/**
* @author wq
* @date 2019-10-21
*/
//@CacheConfig(cacheNames = "benefitDay")
public interface BenefitDayService {

    /**
    * queryAll 分页
    * @param criteria
    * @param pageable
    * @return
    */
    //@Cacheable(keyGenerator = "keyGenerator")
    Object queryAll(BenefitDayQueryCriteria criteria, Pageable pageable);

    /**
    * queryAll 不分页
    * @param criteria
    * @return
    */
    //@Cacheable(keyGenerator = "keyGenerator")
    public Object queryAll(BenefitDayQueryCriteria criteria);

    /**
     * findById
     * @param benefitId
     * @return
     */
    //@Cacheable(key = "#p0")
    BenefitDay findById(Long benefitId);

    /**
     * create
     * @param resources
     * @return
     */
    //@CacheEvict(allEntries = true)
    BenefitDay create(BenefitDay resources);

    /**
     * update
     * @param resources
     */
    //@CacheEvict(allEntries = true)
    void update(BenefitDay resources);

    /**
     * delete
     * @param benefitId
     */
    //@CacheEvict(allEntries = true)
    void delete(Long benefitId);

    /**
     * 根据个人查询分润列表
     * @param agentId
     * @return
     */
    List<BenefitDay> findByAgentId(Long agentId);

    /**
     * 起止时间查询个人分润列表
     * @param agentId
     * @param startDate
     * @param endDate
     * @return
     */
    List<BenefitDay> findByAgentId(Long agentId,String startDate,String endDate);

    /**
     * 分润明细
     * @param agentId
     * @param startDate
     * @param endDate
     * @param isSelf
     * @param pageNum
     * @return
     */
    List<BenefitDay4MineDTO> findMineDetail(Long agentId, String startDate, String endDate, Integer isSelf, Integer pageNum);

    /**
     * 个人的团队月份总交易
     * @param agentId
     * @param month
     * @return
     */
    BigDecimal findTeamBenefitByAgentId(Long agentId,String month);

    /**
     * 个人月总交易
     * @param agentId
     * @param month
     * @return
     */
    BigDecimal findSelfBenefitByAgentId(Long agentId, String month);

    /**
     * 个人当日分润记录
     * @param agentId
     * @param date
     * @return
     */
    BenefitDay findByAgentIdAndDate(Long agentId, String date);

    /**
     * 分页查询
     * @param criteria
     * @param page
     * @param size
     * @return
     */
    Page<BenefitDay> getBenefitPage(BenefitDayQueryCriteria criteria, Integer page, Integer size);


    String getBenefit(List<Long> ids,String startDate,String endDate);
}